<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>margin-top传递</title>
  </head>

  <style>
    .div1 {
      width: 100px;
      height: 100px;
      background-color: pink;
    }

    .div {
      width: 200px;
      height: 200px;
      background-color: red;
    }

    .div2 {
      width: 100px;
      height: 100px;
      background-color: black;
      /* 
      一.margin-top传递
       1.1 如果块级元素的顶部线和父元素的顶部线重叠，那么这个块级元素的margin-top值会传递给父元素
      
       */
      /* margin-left: 20px; */
      margin-top: 20px;
    }
  </style>

  <body>
    <div class="div1"></div>
    <div class="div">
      <div class="div2"></div>
    </div>
  </body>

</html>